function Ennemies() {
    Animals.call(this);
		
	this.pos = { x: 0, y: 0 };
    this.size = { x: 12, y: 12 };
	this.valueAttack;
	
	this.update = function(elapsed, keysDown) {
       
		if(!this.isAlive()) {
			return;
		}
		
		this.randomDirection();
		
		this.updateMovement(elapsed, keysDown);

		if(!this.actionAttack()) {
			this.actionAttackPare(keysDown);
		}
    };
	
	this.actionAttack = function() {
		if(this.isAlive()) {
			var ax = this.getPostionInMapX();
			var ay = this.getPostionInMapY();
			var px = player.getPostionInMapX();
			var py = player.getPostionInMapY();

			if(ax == px && ay == py) {
				return player.setAttack(this.valueAttack);
			}
			else {
				return true;
			}
		}
		else
			return true;
	};
	
	this.actionAttackPare = function(keysDown) {
        var move = { x: 0, y: 0 };
		var deplacement = 32;
		
        if ((this.direction[Keys.Left]) && !(this.direction[Keys.Right]) && !(this.direction[Keys.Up]) && !(this.direction[Keys.Down])) {
            move.x += deplacement;
        }
        else if ((this.direction[Keys.Right]) && !(this.direction[Keys.Left]) && !(this.direction[Keys.Up]) && !(this.direction[Keys.Down])) { 
            move.x -= deplacement;
        }
        else if ((this.direction[Keys.Up]) && !(this.direction[Keys.Right]) && !(this.direction[Keys.Left]) && !(this.direction[Keys.Down])) {
            move.y += deplacement;
        }
        else if ((this.direction[Keys.Down]) && !(this.direction[Keys.Right]) && !(this.direction[Keys.Up]) && !(this.direction[Keys.Left])) {
            move.y -= deplacement;
        }
        else if ((this.direction[Keys.Left]) && !(this.direction[Keys.Right]) && (this.direction[Keys.Up]) && !(this.direction[Keys.Down])) {
            move.x += deplacement;
            move.y += deplacement;
        }
        else if ((this.direction[Keys.Right]) && !(this.direction[Keys.Left]) && (this.direction[Keys.Up]) && !(this.direction[Keys.Down])) { 
            move.x -= deplacement;
            move.y += deplacement;
        }
        else if ((this.direction[Keys.Left]) && !(this.direction[Keys.Right]) && !(this.direction[Keys.Up]) && (this.direction[Keys.Down])) {
            move.x += deplacement;
            move.y -= deplacement;
        }
        else if ((this.direction[Keys.Right]) && !(this.direction[Keys.Left]) && !(this.direction[Keys.Up]) && (this.direction[Keys.Down])) { 
            move.x -= deplacement;
            move.y -= deplacement;
        }
		

		this.pos = levels[currentLevel].moveEntity(this.pos, this.size, this.size, move);
		this.posInMap.x = Math.floor((this.pos.x + (this.size.x / 2)) / tileSize);
		this.posInMap.y = Math.floor((this.pos.y + (this.size.y / 2)) / tileSize);
	}
	
	this.setValueAttack = function(value) {
		this.valueAttack = value;
	}
}